package com.lam.mall.entity;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Size;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.lam.common.base.domain.BaseEntity;
import com.lam.common.base.domain.tree.BaseTree;
import com.lam.common.components.dict.annotation.Dict;
import com.lam.common.utils.DateUtil;
import com.lam.common.validate.annotation.DictCheck;
import com.lam.common.validate.annotation.DictValid;
import com.lam.common.validate.group.Add;

/**
 * 产品类目对象 mall_category
 * 
 * @author admin
 * @date 2023-04-20
 */
@DictCheck
@TableName("mall_category")
public class Category extends BaseTree<Category> implements BaseEntity{

    /** 主键 */
    @Null(groups = Add.class, message="id必须为空")
    @TableId(type = IdType.ASSIGN_ID)
    private String id;
    
    /** 店铺ID */
    @NotNull(message = "店铺ID不能为空")
    private String shopId;

    /** 父节点 */
    private String parentId;

    /** 产品类目名称 */
    @NotBlank(message = "产品类目名称不能为空")
    @Size(max = 50, message = "产品类目名称长度不能超过50个字符")
    private String name;

    /** 类目图标 */
    private String icon;

    /** 类目的显示图片 */
    @NotBlank(message = "类目的显示图片不能为空")
    @Size(max = 300, message = "类目的显示图片长度不能超过300个字符")
    private String pic;

    /** 排序 */
    @NotNull(message = "排序不能为空")
    private Integer seq;

    /** 默认是1，表示正常状态,0为下线状态 */
    @NotNull(message = "状态不能为空")
    @DictValid(message = "无效的状态")
    @Dict(dictCode = "status_type")
    private Integer status;

    /** 分类层级 */
    @NotNull(message = "分类层级不能为空")
    private Integer grade;

    /** 记录时间 */
    @JsonFormat(pattern = DateUtil.PATTERN_DEFAULT)
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    /** 更新时间 */
    @JsonFormat(pattern = DateUtil.PATTERN_DEFAULT)
    @TableField(fill = FieldFill.UPDATE)
    private Date updateTime;
    
    @TableField(exist = false)
    private List<Category> categories;

    public void setId(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    } 

    public void setShopId(String shopId) {
        this.shopId = shopId;
    }

    public String getShopId() {
        return shopId;
    }    
    
    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getParentId() {
        return parentId;
    }    
    
    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getIcon() {
        return icon;
    }    
    
    public void setPic(String pic) {
        this.pic = pic;
    }

    public String getPic() {
        return pic;
    }    
    
    public void setSeq(Integer seq) {
        this.seq = seq;
    }

    public Integer getSeq() {
        return seq;
    }   
    @Override
	public BigDecimal getSortNo() {
		return BigDecimal.valueOf(seq) ;
	}  
    
    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getStatus() {
        return status;
    }    
    
    public void setGrade(Integer grade) {
        this.grade = grade;
    }

    public Integer getGrade() {
        return grade;
    }    
    
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getCreateTime() {
        return createTime;
    }    
    
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

	public List<Category> getCategories() {
		return categories;
	}

	public void setCategories(List<Category> categories) {
		this.categories = categories;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
